package com.itzhigui.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * 使用当前的类来封装多个配置参数
 *
 * @author java1412
 * @since 2024-04-15 09:58:29
 */
@Configuration
// 默认情况读取是application.yml文件
// 指定需要读取的配置文件的前缀,prefix:指定需要读取的配置文件中前缀
@ConfigurationProperties(prefix = "user")
// 指定读取的配置文件名称
@PropertySource(value = "user.properties")
public class MyUserConfig {

    private String username;
    private String password;
    private Integer age;

    public MyUserConfig() {
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
